<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ControleurNews
 *
 * @author Rymdia
 */
class ControleurNews {
    //put your code here
    
    public function __construct() {

        // si on séparait les modèles
        // require_once Chemins::MODELES.'ModeleProduits.class.php';
    }
    public function afficher(){
        VariableGlobales::$lesNews = gestionBD::getLesNews();
        include(Chemins::VUES . "v_news.php");
    }
    
    public function Video(){
        
        $idVideo = $_REQUEST['id'];
       VariableGlobales::$laVideo = gestionBD::getVideobyId($idVideo);
      include(Chemins::VUES . "v_news_video.php");
    }
    
    public function Detail(){
        $idNouvelle = $_REQUEST['id'];
        VariableGlobales::$laNews = gestionBD::getDetailbyID($idNouvelle);
        include(Chemins::VUES. "v_nouvelle.php");
        
    }
    
    public function verifNews(){
        $idNews = $_REQUEST['id'];
        
        $leTest = gestionBD::VerifNewsById($idNews);
       // var_dump(gestionBD::VerifNewsById($idNews));
       if ($leTest = 1){
           
            self::Video();  
     }
        
        elseif($leTest == 0)
        {
         var_dump($leTest);
        self::Detail();
        }
        
    }
    public function afficherVideo(){
        VariableGlobales::$lesVideos = gestionBD::getLesVideos();
        include(Chemins::VUES."v_videos.php");
        
    }
    public function afficherNews(){
        VariableGlobales::$lesEcrites = gestionBD::getLesEcrites();
        include(Chemins::VUES."v_ecrites.php");
    }
}

